# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-number-range
_pkgname=Number-Range
pkgver=0.12
pkgrel=13
pkgdesc='Perl extension defining ranges of numbers and testing if a number is found in the range.'
arch=('any')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl')
url='http://search.cpan.org/dist/Number-Range'
source=("http://search.cpan.org/CPAN/authors/id/L/LA/LARRYSH/$_pkgname-$pkgver.tar.gz")
sha512sums=('d5c2ed41f2eb6caa013d10f4cad295b73157323fcb0496c4e10f4673507965f65f18433d5f4b03e8180fa2108b7e87cf0e23255c493431b5ddeb49562ed997d8')
_distdir="$_pkgname-$pkgver"

build() {
  cd $_distdir

  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'"     \
      PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
      MODULEBUILDRC=/dev/null

    /usr/bin/perl Makefile.PL
    make
  )
}

check() {
  cd $_distdir

  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
    make test
  )
}

package() {
  cd $_distdir

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

